package perso.marcr.lst.service;

import java.io.IOException;
import java.util.List;

import javax.xml.bind.JAXBException;

import org.springframework.oxm.XmlMappingException;

import perso.marcr.lst.model.Configuration;
import perso.marcr.lst.model.ScenarioList;
import perso.marcr.lst.model.TaskList;

public interface TaskService {	

	static final String TASK_EXTENSION = ".xml";

	/**
	 * @return
	 */
	ScenarioList getTaskListResults();

	/**
	 * @param szJobName
	 * @param szTaskId
	 * @return true if the task defined by szTaskId is running.
	 */
	boolean isRunning(String szJobName, String szTaskId);	


	/**
	 * @return a list of all tasks
	 * @throws JAXBException 
	 */
	List<TaskList> getAllTasks(String jobName) throws JAXBException;

	/**
	 * @param scenario
	 * @param jobName
	 * @param taskId
	 * @throws JAXBException
	 * @throws XmlMappingException
	 * @throws IOException
	 */
	void save(ScenarioList scenario, String jobName, String taskId) throws JAXBException, XmlMappingException, IOException;

	/**
	 * @param jobName
	 * @param taskId
	 * @return
	 * @throws JAXBException
	 */
	ScenarioList read(String jobName, String taskId) throws JAXBException;

	/**
	 * @param szJobName
	 * @param szTaskId
	 * @param configuration
	 * @throws IOException 
	 * @throws JAXBException 
	 * @throws XmlMappingException 
	 */
	void launchTest(String szJobName, String szTaskId, Configuration configuration) throws XmlMappingException, JAXBException, IOException;

	/**
	 * @param jobName
	 * @param taskId
	 */
	void delete(String jobName, String taskId);
}
